package cn.young.javalearning.designpattern.factorypattern.f_factorymethod;

import cn.young.javalearning.designpattern.factorypattern.bean.f_bean.Apple;
import cn.young.javalearning.designpattern.factorypattern.bean.f_bean.Orange;

public class Main {
    public static void main(String[] args) {
        OrangeMethodFactoryBean orangeFactoryBean = new OrangeMethodFactoryBean();
        Orange orange = (Orange) orangeFactoryBean.produceFruit(Orange.class);
        orange.setColor("green");
        orange.setSize("middle");
        System.out.println("fruit = [" + orange + "]");

        AppleMethodFactoryBean appleFactoryBean = new AppleMethodFactoryBean();
        Apple apple = (Apple) appleFactoryBean.produceFruit(Apple.class);
        apple.setColor("red");
        apple.setSize("big");
        System.out.println("fruit = [" + apple + "]");
    }
}
